/*    */ package cn.zzuisa.news.util;
/*    */ 
/*    */ import com.google.gson.Gson;
/*    */ import com.google.gson.JsonObject;
/*    */ import com.google.gson.JsonParser;
/*    */ import java.io.BufferedReader;
/*    */ import java.io.IOException;
/*    */ import java.io.InputStreamReader;
/*    */ import java.io.PrintWriter;
/*    */ import javax.servlet.ServletInputStream;
/*    */ import javax.servlet.http.HttpServletRequest;
/*    */ import javax.servlet.http.HttpServletResponse;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class JsonUtil
/*    */ {
/*    */   public static String getStrResponse(HttpServletRequest request) throws IOException {
/* 25 */     String strResponse = "";
/*    */     try {
/* 27 */       ServletInputStream servletInputStream = request.getInputStream();
/* 28 */       String strMessage = "";
/*    */       
/* 30 */       BufferedReader reader = new BufferedReader(new InputStreamReader(servletInputStream, "utf-8"));
/*    */       
/* 32 */       while ((strMessage = reader.readLine()) != null) {
/* 33 */         strResponse = String.valueOf(strResponse) + strMessage;
/*    */       }
/* 35 */       reader.close();
/* 36 */       servletInputStream.close();
/* 37 */     } catch (IOException e) {
/* 38 */       e.printStackTrace();
/*    */     } 
/*    */     
/* 41 */     return strResponse;
/*    */   }
/*    */ 
/*    */   
/* 45 */   public static PrintWriter writer(HttpServletResponse response) throws IOException { return response.getWriter(); }
/*    */ 
/*    */ 
/*    */ 
/*    */   
/* 50 */   public static JsonObject setData(Object object) { return (new JsonParser()).parse((new Gson()).toJson(object)).getAsJsonObject(); }
/*    */ }


/* Location:              /Users/frank/Desktop/admin/WEB-INF/classes/!/cn/zzuisa/news/util/JsonUtil.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.0.7
 */